<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<% String root = request.getContextPath();%>
<!DOCTYPE html>
<html>
	<head>
		<title>热词系统后台管理</title>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
		<link rel="stylesheet" href="<%=root%>/resources/ulp/base.css" type="text/css">
		<link rel="stylesheet" href="<%=root%>/resources/ulp/login.css" type="text/css">
		<link rel="stylesheet" type="text/css" media="screen" href="<%=root%>/resources/ulp/jquery-ui.css" />
		<link rel="stylesheet" type="text/css" href="<%=root%>/resources/ulp/easyui.css">
		<link rel="stylesheet" href="<%=root%>/resources/ulp/jquery.alerts.css" type="text/css">
		<link rel="stylesheet" type="text/css" media="screen,projection" href="<%=root%>/resources/ulp/bridge.css" />
		<style>
html {
	overflow-x: hidden;
}
</style>
		<style>
img,div,table,tr,th,h1,li,a {
	behavior: url(<%=root%>/resources/ulp/iepngfix.htc)
}
</style>
		<script src="<%=root%>/resources/ulp/jquery.min.js" type="text/javascript"></script>
		<script src="<%=root%>/resources/ulp/xalert.js" type="text/javascript"></script>
		<script src="<%=root%>/resources/ulp/jquery.alerts.js" type="text/javascript"></script>
		<script src="<%=root%>/resources/ulp/jquery.easyui.min.js" type="text/javascript"></script>
		<script src="<%=root%>/resources/ulp/jquery.public.js"></script>
		<script src="<%=root%>/resources/ulp/jquery.hl.js" type="text/javascript"></script>
		<script src="<%=root%>/resources/ulp/jquery.hlGrid.js" type="text/javascript"></script>
		<script src="<%=root%>/resources/ulp/md5.js"></script>
		<script src="<%=root%>/resources/ulp/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
			
	configurations={
		init:{
			graphic:false
		},
		empty:{
			uname:"请输入用户名!",
			pwd:"请输入密码!",
			rand:"请输入验证码!"
		},
		lengthCheck:{
			pwd:"请输入3-10位密码!"
		},
		actions:{
			login:"login",
			graphicCode:"jkRandom"
		},
		cssName:{
			right:"",
			error:"errortip"
		}
	};

	// 提交form
	$(function($){
		//空验证
		function isEmpty(id,errId,msg){
			var text=$("#"+id).attr("value");
			if(!text){
				$("#"+errId).empty().append(msg).attr("className",configurations.cssName.error);
				return false;
			}else{
				$("#"+errId).empty().attr("className",configurations.cssName.right);
				return true;
			}
		}

		function isLengthEnough(id,errId,msg,length){
			var text=$("#"+id).attr("value");
			if(text.length<length){
				$("#"+errId).empty().append(msg).attr("className",configurations.cssName.error);
				return false;
			}else{
				$("#"+errId).empty().attr("className",configurations.cssName.right);
				return true;
			}
		}

		

		//事件注册
		$("#username").blur(
			function(){
				isEmpty("username","unameErr",configurations.empty.uname);
			}
		);
		$("#password").blur(
			function(){
				isEmpty("password","pwdErr",configurations.empty.pwd);
				isLengthEnough("password","pwdErr",configurations.lengthCheck.pwd,3);
			}
		);
		$("#random").blur(
			function(){
				isEmpty("random","randErr",configurations.empty.rand);
			}
		);
		$("#password").focus(function(){
			if(!configurations.init.graphic){
			var src = configurations.actions.graphicCode;
				$("#yzmId").attr("src",src);
				$("#yzmId").show();
				configurations.init.graphic=true;
			}
		});
		$("#random").focus(function(){
			if(!configurations.init.graphic){
			var src = configurations.actions.graphicCode;
				$("#yzmId").attr("src",src);
				$("#yzmId").show();
				configurations.init.graphic=true;
			}
		});
		$("#yzmId").click(function(){
			var yzmsrc= configurations.actions.graphicCode+"?"+Math.random();
			$("#yzmId").attr("src",yzmsrc);
		});
		
		// 验证form
		function validation()
		{
			$("#username,#password,#random").blur();
			return $("."+configurations.cssName.error).size()==0;
		}
		
		//服务端错误信息
		$("#randErr,#pwdErr,#unameErr").each(
			function (ele){
				if($(this).text().length>0){
					$(this).attr("className",configurations.cssName.error);
				}
			}
		);
		
		$("#btn_reset").click(function(){
			$("#username").val("");
			$("#password").val("");
			$("#random").val("");
			getfocus();
		});
		//回车登陆事件
		 $('#random').bind('keyup',function(event) {  
          if(event.keyCode==13){
               login(); 
       	 }  
         });  
		//登陆事件
		$("#btn_submit").click( function () { 
			login(); 
		});
		function login(){
			$("#mySubmit").submit();
		}
	
	});
	
	function reloadPage() {
       window.opener = null;
	   window.open('', '_self', ''); 
	   window.close();
     }
	function getfocus(){
			if($("#username").val() == ""){
				$("#username").focus();
			}else if($("#password").val() == ""){
				$("#password").focus();
			}else if($("#random").val() == ""){
				$("#random").focus();
			}
		}
    </script>


		<script language="javascript" for="document" event="onkeydown"> 
     if (event.keyCode == 13){  
      	 $("#btn_submit").trigger('click');
     }  
	</script>


	</head>
	<body>
		<div id="login_box">
			<div class="login_wrap">
				<div class="login_tb">
					<form:form modelAttribute="loginCommand" id="mySubmit">
						<table>
							<tr>
								<td width="100px" align="right">
									Email：
								</td>
								<td>
									<input class="txtinput" id="username" name="email"
										maxlength="20" value="" />
								</td>
								<td>
									<span id="unameErr"><form:errors path="email" cssClass="errors"/></span>
								</td>
							</tr>
							<tr>
								<td align="right">
									密&nbsp;&nbsp;码：
								</td>
								<td>
									<input class="txtinput" type="password" id="password"
										value="" name="password" validType="length[3,10]"
										maxlength="20" />
								</td>
								<td>
									<span id="pwdErr"><form:errors path="password"  cssClass="errors"/></span>
								</td>
							</tr>
							<tr>
								<td align="right">
									验证码：
								</td>
								<td>
									<input class="txtinput round" name="random" id="random"
										maxlength="4" value="" />
									<img border="0" src="" width="100" height="50" id="yzmId"
										title="看不清,换一张"
										style="cursor: pointer; display: none; * margin-top: -15px; position: relative; top: -2px;" />
								</td>
								<td>
									<span id="randErr"><form:errors path="random" cssClass="errors"/></span>
								</td>
							</tr>
							<tr>
								<td></td>
								<td height="100px">
									<input type="button" class="btn_submit" id="btn_submit"
										value="" />
									<input type="button" readonly="readonly" class="btn_reset"
										id="btn_reset" />
								</td>
								<td></td>
							</tr>
						</table>
					</form:form>
					<div class="company">
						远达项目组版权所有
					</div>
					<div id="head_tag_bg">
						<iframe></iframe>
					</div>
					<div id="ie6_tipbg">
						<p>
							建议您升级当前浏览器到更高的版本，以获得更佳的浏览体验，或使用其他免费的浏览器：
						</p>
						<div>
							<a href="http://www.firefox.com.cn/download/" target="_blank"><img
									src="<%=root%>/resources/ulp/images/login_frifox.gif" />
							</a> &nbsp;&nbsp;&nbsp;&nbsp;
							<a href="javascript:;"
								onclick="$('#ie6_tipbg,#head_tag_bg').hide();"><img
									src="<%=root%>/resources/ulp/images/login_close.gif" />
							</a>
						</div>
					</div>
				</div>
			</div>
		</div>
		<script type="text/javascript">
  $(document).ready(function(){
			  domHover("#btn_reset","reset_hover");
			  domHover("#btn_submit","submit_hover");
  });
  
  
  
  if($.browser.msie&&($.browser.version == "6.0")&&!$.support.style ){
  		var mg = '';
		if(mg.length == 0){
			$("#ie6_tipbg,#head_tag_bg").show();
		}
		
  }
	
</script>
	</body>
</html>